home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCommon / Include / FWStdDef.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  5.7 KB  |  251 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWStdDef.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    (c) 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSTDDEF_H
  11. #define FWSTDDEF_H
  12.  
  13. #ifndef FWENVDEF_H
  14. #include "FWEnvDef.h"
  15. #endif
  16.  
  17. #if defined(FW_BUILD_MAC) & !defined(__TYPES__)
  18. #include <Types.h>
  19. #endif
  20.  
  21. #if defined(FW_BUILD_MAC) & !defined(__LOWMEM__)
  22. #include <LowMem.h>
  23. #endif
  24.  
  25. #if defined FW_BUILD_MAC  && !defined __FILES__
  26. #include <Files.h>
  27. #endif
  28.  
  29. #ifdef FW_BUILD_WIN
  30. #include <windows.h>
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34.   extern "C" {
  35. #endif
  36.  
  37. /*========================================================================================
  38. /  Macro definitions
  39. /
  40. /    The macros FW_SHARED_MEMBER and  FW_SHARED_GLOBAL should only be used for placement.  
  41. /    ODF is built with model large, so pointers are always far by default.  However, 
  42. /    static data in DLLs must still have the __far keyword in order to be accessible across DLLs.
  43. /========================================================================================*/
  44.  
  45. #ifdef FW_BUILD_MAC
  46. #define FW_SHARED_MEMBER
  47. #define FW_SHARED_GLOBAL
  48. #endif
  49.  
  50. #ifdef FW_BUILD_WIN
  51.  
  52. #ifdef FW_BUILD_WIN32
  53.     //     [KVV] Microsoft C++ 2.0 produces a compile error when a member of
  54.     //     an exported class is itself exported.  So we nee to differentiate between
  55.     //    shared member and shared global
  56. #define FW_SHARED_MEMBER
  57. #define FW_SHARED_GLOBAL __declspec(dllexport)
  58. #endif
  59.  
  60. #ifdef FW_BUILD_WIN16
  61. #define FW_SHARED_MEMBER __export __far
  62. #define FW_SHARED_GLOBAL __export __far
  63. #endif
  64.  
  65. #endif
  66.  
  67. #ifdef FW_BUILD_MAC
  68. #define FW_CLASS_ATTR
  69. #define FW_FUNC_ATTR
  70. #endif
  71.  
  72. #ifdef FW_BUILD_WIN32
  73.  
  74. #ifdef __SC__
  75. #define FW_CLASS_ATTR // __export
  76. #define FW_FUNC_ATTR // __export
  77. #else
  78. #define FW_CLASS_ATTR // __declspec(dllexport)
  79. #define FW_FUNC_ATTR // __declspec(dllexport)
  80. #endif
  81.  
  82. #endif
  83.  
  84. #ifdef FW_BUILD_WIN16
  85. #define FW_CLASS_ATTR __export
  86. #define FW_FUNC_ATTR __export
  87. #endif
  88.  
  89. #ifndef SOMCHKEXCEPT
  90. #define SOMCHKEXCEPT You_forgot_to_include_FWODExce_has_the_first_header_in your__cpp
  91. #endif
  92.  
  93. /*========================================================================================
  94. // Define OpenDoc version number so we can use appropriate interface
  95. /========================================================================================*/
  96.  
  97. #ifndef FW_OPENDOC_VERSION
  98.  
  99. #define FW_OPENDOC_DR1    1
  100. #define FW_OPENDOC_DR2    2
  101. #define FW_OPENDOC_DR3    3
  102. #define FW_OPENDOC_DR4    4
  103. #define FW_OPENDOC_100    5
  104.  
  105. #ifdef FW_BUILD_MAC
  106. #define FW_OPENDOC_VERSION     FW_OPENDOC_DR4
  107. #endif
  108.  
  109. #ifdef FW_BUILD_WIN
  110. #define FW_OPENDOC_VERSION     FW_OPENDOC_DR2
  111. #endif
  112.  
  113. #endif
  114.  
  115. /*========================================================================================
  116. /  Type definitions
  117. /========================================================================================*/
  118.  
  119. typedef     unsigned char     FW_Boolean;
  120.  
  121. typedef     unsigned short     FW_ResourceId;
  122.  
  123. typedef     unsigned short     FW_Milliseconds;
  124.  
  125. typedef     unsigned long     FW_TypeToken;
  126.  
  127. // ----- Macintosh -----
  128. #ifdef FW_BUILD_MAC
  129.  
  130. typedef     char**             FW_PlatformHandle;
  131.  
  132. typedef     unsigned long     FW_ResourceType;
  133.  
  134. typedef     FSSpec*            FW_Instance;
  135.  
  136. typedef     double_t         FW_Double;
  137.  
  138. typedef     Rect            FW_PlatformRect;
  139. typedef     Point            FW_PlatformPoint;
  140. typedef        short            FW_PlatformCoordinate;
  141.  
  142. #endif
  143.  
  144.  
  145. // ----- Windows -----
  146. #ifdef FW_BUILD_WIN
  147.  
  148. typedef        HANDLE             FW_PlatformHandle;
  149.  
  150. typedef     unsigned short     FW_ResourceType;
  151.  
  152. typedef     HINSTANCE         FW_Instance;
  153.  
  154. typedef     RECT            FW_PlatformRect;
  155. typedef     POINT            FW_PlatformPoint;
  156.  
  157. typedef     long double     FW_Double;
  158.  
  159. #ifdef FW_BUILD_WIN32
  160. typedef    long                FW_PlatformCoordinate;
  161. #endif
  162. #ifdef FW_BUILD_WIN16
  163. typedef        int                FW_PlatformCoordinate;
  164. #endif
  165.  
  166. #endif
  167.  
  168. /*========================================================================================
  169. /  Mac A5 Globals
  170. /========================================================================================*/
  171.  
  172. #ifdef FW_BUILD_MAC
  173.  
  174. #pragma options align=mac68k
  175. typedef struct
  176. {
  177.     char        privates[76];
  178.     long        randSeed;
  179.     BitMap        screenBits;
  180.     Cursor        arrow;
  181.     Pattern        dkGray;
  182.     Pattern        ltGray;
  183.     Pattern        gray;
  184.     Pattern        black;
  185.     Pattern        white;
  186.     GrafPtr        thePort;
  187. } FW_QDGlobalRec;
  188.  
  189. #define FW_QDGlobals (*(FW_QDGlobalRec*)( *(char**)LMGetCurrentA5() \
  190.                             - sizeof(FW_QDGlobalRec) + sizeof(GrafPtr)))
  191.  
  192. #pragma options align=reset
  193. #endif
  194.  
  195. /*========================================================================================
  196. /  Constants
  197. /========================================================================================*/
  198.  
  199. #ifndef NULL
  200. #define NULL 0
  201. #endif
  202.  
  203. #ifndef FALSE
  204. #define FALSE 0
  205. #endif
  206.  
  207. #ifndef TRUE
  208. #define TRUE 1
  209. #endif
  210.  
  211. /*========================================================================================
  212. /  Macros
  213. /========================================================================================*/
  214.  
  215. #define FW_UNUSED(x)    ((void) &x)
  216.  
  217. #ifdef __cplusplus
  218.    }
  219. #endif
  220.  
  221. //========================================================================================
  222. //  Minimum and maximum functions
  223. //========================================================================================
  224.  
  225. #define FW_PRIV_DEFINE_MIN_MAX(t)            \
  226.     inline t FW_Minimum(t a, t b)            \
  227.         {    return a < b ? a : b;    }        \
  228.     inline t FW_Maximum(t a, t b)            \
  229.         {    return a > b ? a : b;    }
  230.         
  231. #define FW_PRIV_DEFINE_ABS(t)                \
  232.     inline t FW_Absolute(t a)                \
  233.         {    return a > 0 ? a : -a;    }
  234.  
  235. FW_PRIV_DEFINE_MIN_MAX(short)
  236. FW_PRIV_DEFINE_ABS(short)
  237.  
  238. FW_PRIV_DEFINE_MIN_MAX(unsigned short)
  239.  
  240. FW_PRIV_DEFINE_MIN_MAX(int)
  241. FW_PRIV_DEFINE_ABS(int)
  242.  
  243. FW_PRIV_DEFINE_MIN_MAX(unsigned int)
  244.  
  245. FW_PRIV_DEFINE_MIN_MAX(long)
  246. FW_PRIV_DEFINE_ABS(long)
  247.  
  248. FW_PRIV_DEFINE_MIN_MAX(unsigned long)
  249.  
  250. #endif
  251.